<template>
  <view class="container" style="position: relative;">
    <cu-custom bgColor="bg-blue" :isBack="true">
      <block slot="content">补片</block>
    </cu-custom>
    <view class="qrcodeModal bg-white">
      <u-search :showAction="true" v-model="searchOrderNum" placeholder="请输入订单编号" actionText="搜索" @search="getALLData" @custom="getALLData"
        :animation="true"></u-search>
    </view>
    <view class="padding padding-top-xs">
      <scroll-view scroll-y="true" style="max-height: calc(100vh - 420rpx);padding-top: 24rpx;">
        <view class="dateItem" v-for="(item,index) in searchList" :key="index" v-if="index<100">
          <view class="headBox flex justify-between align-center">
            <view class="title">{{item.orderNo}}</view>
            <view class="flex align-center">
              <view class="date margin-right">{{item.urls?JSON.parse(item.urls).length:0}}个裁片</view>
            </view>
          </view>
          <view class="padding-tb">
            <view class="title">{{item.reason}}</view>
          </view>
          <view class="padding-bottom flex align-center justify-between">
            <view class="title">申请人:{{item.createBy||'-'}}</view>
          </view>
          <view class="padding-bottom flex align-center justify-between">
            <view class="title">责任人:{{item.responsibleName}}</view>
            <view class="date ">{{item.createTime}}</view>
          </view>
        </view>
      </scroll-view>
    </view>
    <view style="width:140rpx;position: fixed;
    right: 40rpx;
    bottom: 20rpx;" class="flex align-center justify-center">
      <image src="/static/tab/icon_sao.png" style="width:140rpx;" mode="widthFix" @click="setSaoMa"></image>
    </view>
    <u-notify ref="uNotify"></u-notify>
  </view>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from 'vuex';
  export default {
    components: {},
    data() {
      return {
        code: null,
        name: '',
        searchOrderNum: '',
        orderNum: '',
        historyList: [],
        searchList: [],
        TTSSpeech: null,
        modelItem: {},
        poupShow: false,
      };
    },
    onPageScroll(e) {},
    onReady() {},
    onLoad(option) {},
    onShow() {
      this.getALLData()
    },
    computed: {
      ...mapState(['userInfo'])
    },
    methods: {
      setSaoMa(e) {
        uni.scanCode({
          scanType: ['barCode', 'qrCode'], //扫码类型 
          autoZoom: true, //是否启用自动放大，默认启用
          success: (res) => {
            let result = '';
            let seq = '';
            if (res.result.includes('|')) {
              result = res.result.split('|')[0];
              seq = res.result.split('|')[1];
            } else {
              result = res.result
              seq = ''
            }
            uni.navigateTo({
              url: `/pages/index/bpDetail?orderNo=${result}&seq=${seq}`
            })
          }
        });
      },
      navTo(item) {
        uni.navigateTo({
          url: `/pages/index/bpDetail?orderNo=${item.orderNo}&seq=${item.seq}`
        })
      },
      getALLData() {
        this.$ComFunJS.ajax({
          method: 'get',
          data: {
            orderNo: this.searchOrderNum,
          },
          url: "/system/wechat/patch/list",
          success: (res) => {
            this.searchList = res.rows
          }
        })
      },
    },
  }
</script>

<style lang="scss">
  page {
    background: #F5F6F7;
  }

  .modelShowTitle {
    font-size: 32rpx;
    font-weight: 500;
    color: rgba(49, 55, 64, 1);
    margin-bottom: 12rpx;
  }

  .inputPlace {
    color: rgba(0, 0, 0, 0.5);
  }

  .modelInput {
    width: 100%;
    height: 96rpx;
    background: rgba(165, 168, 173, .08);
    border-radius: 12rpx;
    min-height: 48px;
    padding: 14rpx;
    display: flex;
    align-items: center;

    input {
      width: 100%;
      color: #2a2a2a;
      background: none;
      border: none;
    }
  }

  .qrcodeModal2 {
    padding: 30upx 160upx;
    position: absolute;
    width: 100%;
    top: 300rpx;
    opacity: .2;

    .qrcodeText {
      position: relative;
      font-size: 28upx;
      font-weight: 500;
      letter-spacing: 0px;
      line-height: 28.96px;
      color: rgba(41, 63, 102, 1);
      text-align: center;
      top: -100upx;
    }
  }

  .qrcodeModal {
    padding: 30upx;
    width: 100%;

    .qrcodeText {
      position: relative;
      font-size: 40upx;
      font-weight: 500;
      letter-spacing: 0px;
      line-height: 28.96px;
      color: rgba(41, 63, 102, 1);
      text-align: center;
      top: -100upx;
    }

    .qrcodeIntro {
      font-size: 28upx;
      position: relative;
      font-weight: 400;
      color: rgba(154, 165, 184, 1);
      text-align: center;
      top: -90upx
    }
  }

  .qrcodeButton {
    width: 100%;
    height: 96upx;
    opacity: 1;
    border-radius: 122upx;
    background: linear-gradient(180deg, rgba(18, 96, 252, 1) 0%, rgba(38, 129, 255, 1) 100%);
    box-shadow: 0px 17upx 51upx rgba(233, 239, 245, 1);
    text-align: center;
    font-size: 28upx;
    color: #fff;
    line-height: 96upx;
    letter-spacing: 2upx;
  }

  .u-modal__content {
    flex-direction: column !important;
  }

  .cancleBtn {
    width: 260.62upx;
    height: 80upx;
    opacity: 1;
    border-radius: 12rpx;
    background: rgba(0, 0, 0, 0.05);
    font-size: 32upx;
    font-weight: 500;
    letter-spacing: 6px;
    color: rgba(49, 55, 64, 1);

    &.sumbit {
      background: linear-gradient(180deg, rgba(18, 96, 252, 1) 0%, rgba(38, 129, 255, 1) 100%);
      color: #FFFFFF;
    }
  }

  .dateItem {
    width: 100%;
    opacity: 1;
    border-radius: 16rpx;
    background: rgba(255, 255, 255, 1);
    padding: 0 30rpx;
    margin-top: 16rpx;

    .headBox {
      border-bottom: 1px solid rgba(154, 165, 184, 0.11);
      padding: 20rpx 0;
    }

    .title {
      font-size: 28rpx;
      font-weight: 500;
      color: rgba(49, 55, 64, 1);
      text-align: left;
    }

    .date {
      font-size: 24rpx;
      font-weight: 400;
      color: rgba(130, 132, 135, 1);
      text-align: left;
    }

    .allPrice {
      font-size: 34rpx;
      font-weight: 700;
      color: rgba(18, 96, 252, 1);
    }

    .price {
      font-size: 32rpx;
      font-weight: 400;
      color: rgba(130, 132, 135, 1);
    }
  }
</style>